<template>
	<view class="content">
		<u-empty v-show="showEmp" text="暂无数据" mode="list"></u-empty>
		<view
			@click="$to(`../looking-for-goods/looking-for-goods?status=赏金&toBeDetermined=true&isMe=true&id=${item.id}&determinedStatus=${1}`)"
			v-for="(item,index) in dataList" class="content-view f-c">
			<view class="">
				<image class="img" :src="$u.baseUrl+item.coverimg" mode=""></image>
			</view>

			<view class="themeColor">
				<view class="f30 bold mb20">{{item.name}}</view>
				<view class="f25 mb20">
					<text class="type">类别：{{item.goodstype.name}}</text>
					<text>价格：￥{{item.money}}</text>
				</view>
			</view>

			<view class="btn">
				<button v-if="item.determinedStatus==1" @click.stop="toDetermined(item.id)" class="themeBac cwhite f30">确定</button>
				<view v-else class="f30">待领取</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				showEmp:false
			}
		},
		onLoad() {
			this.determined()
		},
		methods: {
			async determined() {
				const res = await this.$u.api.determined({
					id: this.vuex_user.id
				})
				console.log(res);
				this.dataList = res.data
				!res.success?this.showEmp=true:this.showEmp=false
			},
			async toDetermined(id) {
				const res = await this.$u.api.determineBtn({
					id
				})
				console.log(res);
				if(!res.success){
					this.$u.toast(res.msg)
					return;
				}
				this.$redirec('../my-release/my-release')
			}
		}
	}
</script>

<style>
	.content-view {
		position: relative;
		margin: 10rpx 30rpx;
		background-color: #D8D8D8;
		padding: 10rpx;
	}

	.img {
		width: 150rpx;
		height: 150rpx;
		margin-right: 20rpx;
	}

	.btn {
		position: absolute;
		right: 10rpx;
		bottom: 20rpx;
	}

	.btn button {
		line-height: 55rpx;
		padding: 0 30rpx;
		border-radius: 40rpx;
	}

	.type {
		margin-right: 30rpx;
	}
	.u-empty{
		margin-top: 100rpx!important;
	}
</style>
